<?php

class Admin_Form_EditNewsForm extends Zend_Form {
    public $cat_items;
    public function init() {        
        $this->setMethod('post');
        $this->setDecorators(array(
                          array('viewScript',
                          array('viewScript'=>'form/editnewsform.phtml'),
                     )));
        $id = $this->createElement("hidden", "id");
        $this->addElement($id);
        
        $title = $this->createElement("text","title");
		$title->setAttrib("class", "text-input small-input");
		$title->setLabel("Tiêu đề");
                $title->removeDecorator('HtmlTag')->removeDecorator('Label');
		$this->addElement($title);
		
		$title_en = $this->createElement("text","title_en");
		$title_en->setAttrib("class", "text-input small-input");
		$title_en->setLabel("Tiêu đề(EN)");
                $title_en->removeDecorator('HtmlTag')->removeDecorator('Label');
		$this->addElement($title_en);
		
		$url = $this->createElement("text", "thumbnail_url");
		$url->setAttrib("class", "text-input small-input browse");
                $url->removeDecorator('HtmlTag')->removeDecorator('Label');
		//$url->setLabel("URL Thumbnail");
		$this->addElement($url);
		
		$description = $this->createElement("textarea", "des");
		$description->setAttrib("class", "text-input small-input");
		$description->setAttrib("rows",4);
                $description->removeDecorator('HtmlTag')->removeDecorator('Label');
		//$description->setLabel("Mô tả chung (ít hơn 255 kí tự)");
		$this->addElement($description);
		
		$description_en = $this->createElement("textarea", "des_en");
		$description_en->setAttrib("class", "text-input small-input");
		$description_en->setAttrib("rows",4);
                $description_en->removeDecorator('HtmlTag')->removeDecorator('Label');
		//$description_en->setLabel("Mô tả chung - EN (ít hơn 255 kí tự)");
		$this->addElement($description_en);
		
		$content = $this->createElement("textarea", "content");
		$content->setAttrib("class", "ckeditor");
                $content->removeDecorator('HtmlTag')->removeDecorator('Label');
		//$content->setLabel("Nội dung");
		$this->addElement($content);
		
		$content_en = $this->createElement("textarea", "content_en");
		$content_en->setAttrib("class", "ckeditor");
                $content_en->removeDecorator('HtmlTag')->removeDecorator('Label');
		//$content_en->setLabel("Nội dung(EN)");
		$this->addElement($content_en);				
		$cat_model = new Admin_Model_Category();
                $cat_data = $cat_model->listAll();                               
                $cats=$this->createElement("select","cats");
                foreach($cat_data as $item){
                    $cats->addMultiOption($item['id'],$item['name']);
                }
                $cats->removeDecorator('HtmlTag')->removeDecorator('Label');		
		$this->addElement($cats);
                
                $cats_hidden = $this->createElement("hidden", "cats_item",array(
                    'isArray' => true
                ));
                $cats_hidden->removeDecorator('HtmlTag')->removeDecorator('Label');	
                $this->addElement($cats_hidden);
       
                
        
        $submit = $this->createElement("submit", "save");
        $submit->setLabel("Lưu");
        $submit->setAttrib("class", "button");
        $this->addElement($submit);
    }

}

?>